home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
STRINGS
/
TPSTR7
/
EXAM32.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-03-15
|
7KB
|
160 lines
Program Exam32;
{**************************************************************************}
{ }
{ Ce programme démontre les possibilités de ?Trim?. }
{ }
{**************************************************************************}
Uses
TpStr;
Var
S1 ,
S2 : String;
{ --------------------------------------------------------------- }
{ Procedure ATrim(Var Str1: String); }
{ --------------------------------------------------------------- }
{ }
{ Effet : Supprime tous les caractères espaces de la chaîne <Str1>. }
{ }
{ Usage : Chaîne pascal. }
{ }
{ Vitesse : 7800/s }
{ }
{ -------------------------------------------------------------------------}
Procedure Test1;
Begin
S1 := 'a b c d e f ';
ATrim(S1);
S1 := ' a b c e f';
ATrim(S1);
S1 := 'abcdef';
ATrim(S1);
end;
{ --------------------------------------------------------------- }
{ Function ATrim_(Str1: String):String; }
{ --------------------------------------------------------------- }
{ }
{ Effet : Idem, transformé en fonction. }
{ }
{ Usage : Chaîne pascal. }
{ }
{ Vitesse : 7800/s }
{ }
{ -------------------------------------------------------------------------}
Procedure Test2;
Begin
S1 := 'a b c d e f ';
S2 := ATrim_(S1);
S1 := ' a b c e f';
S2 := ATrim_(S1);
S1 := 'abcdef';
S2 := ATrim_(S1);
end;
{ --------------------------------------------------------------- }
{ Procedure LTrim(Var Str1: String); }
{ --------------------------------------------------------------- }
{ }
{ Effet : Supprime tous les caractères espaces à gauche de la chaîne }
{ <Str1>. }
{ }
{ Usage : Chaîne pascal. }
{ }
{ Vitesse : 7800/s }
{ }
{ -------------------------------------------------------------------------}
Procedure Test3;
Begin
S1 := 'a b c d e f ';
LTrim(S1);
S1 := ' a b c e f';
LTrim(S1);
S1 := 'abcdef';
LTrim(S1);
end;
{ --------------------------------------------------------------- }
{ Function LTrim_(Str1: String):String; }
{ --------------------------------------------------------------- }
{ }
{ Effet : Idem, transformé en fonction. }
{ }
{ Usage : Chaîne pascal. }
{ }
{ Vitesse : 7800/s }
{ }
{ -------------------------------------------------------------------------}
Procedure Test4;
Begin
S1 := 'a b c d e f ';
S2 := LTrim_(S1);
S1 := ' a b c e f';
S2 := LTrim_(S1);
S1 := 'abcdef';
S2 := LTrim_(S1);
end;
{ --------------------------------------------------------------- }
{ Procedure RTrim(Var Str1: String); }
{ --------------------------------------------------------------- }
{ }
{ Effet : Supprime tous les caractères espaces à droite de la chaîne }
{ <Str1>. }
{ }
{ Usage : Chaîne pascal. }
{ }
{ Vitesse : 7800/s }
{ }
{ -------------------------------------------------------------------------}
Procedure Test5;
Begin
S1 := 'a b c d e f ';
RTrim(S1);
S1 := ' a b c e f';
RTrim(S1);
S1 := 'abcdef';
RTrim(S1);
end;
{ --------------------------------------------------------------- }
{ Function RTrim_(Str1: String):String; }
{ --------------------------------------------------------------- }
{ }
{ Effet : Idem, transformé en fonction. }
{ }
{ Usage : Chaîne pascal. }
{ }
{ Vitesse : 7800/s }
{ }
{ -------------------------------------------------------------------------}
Procedure Test6;
Begin
S1 := 'a b c d e f ';
S2 := RTrim_(S1);
S1 := ' a b c e f';
S2 := RTrim_(S1);
S1 := 'abcdef';
S2 := RTrim_(S1);
end;
Begin
Test1;
Test2;
Test3;
Test4;
Test5;
Test6;
End.
{ -------------------------------------------------------------------------}